<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>HTML与CSS进阶 | XC's Blog</title><meta name="keywords" content="前端经验"><meta name="author" content="XC's Blog"><meta name="copyright" content="XC's Blog"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="HTML与CSS进阶本文主要介绍H5新增内容以及CSS3中的新特性。在H5方面主要介绍拓展了哪些内容，CSS3方面介绍动画及转换。 H5新增内容「1. 什么是HTML5」  定义：HTML5定义了HTML标准的最新版本，是对HTML的第五次重大修改，号称下一代的HTML。  两个概念：   是一个新版本的HTML语言，定义了新的标签、特性和属性 拥有一个强大的技术集，这些技术集是指：HTML5、C"><meta property="og:type" content="article"><meta property="og:title" content="HTML与CSS进阶"><meta property="og:url" content="https://webxc.eu.org/post/598947694/index.html"><meta property="og:site_name" content="XC&#39;s Blog"><meta property="og:description" content="HTML与CSS进阶本文主要介绍H5新增内容以及CSS3中的新特性。在H5方面主要介绍拓展了哪些内容，CSS3方面介绍动画及转换。 H5新增内容「1. 什么是HTML5」  定义：HTML5定义了HTML标准的最新版本，是对HTML的第五次重大修改，号称下一代的HTML。  两个概念：   是一个新版本的HTML语言，定义了新的标签、特性和属性 拥有一个强大的技术集，这些技术集是指：HTML5、C"><meta property="og:locale" content="zh_CN"><meta property="og:image" content="https://npm.elemecdn.com/webxc@1.0.0/cover/html2.jpg"><meta property="article:published_time" content="2022-01-03T18:00:00.000Z"><meta property="article:modified_time" content="2023-08-30T18:00:49.041Z"><meta property="article:author" content="XC&#39;s Blog"><meta property="article:tag" content="前端经验"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://npm.elemecdn.com/webxc@1.0.0/cover/html2.jpg"><link rel="shortcut icon" href="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><link rel="canonical" href="https://webxc.eu.org/post/598947694/"><link rel="preconnect" href="//cdn.jsdelivr.net"><link rel="preconnect" href="//busuanzi.ibruce.info"><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://npm.elemecdn.com/@fortawesome/fontawesome-free@6.2.0/css/all.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/node-snackbar/dist/snackbar.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/@fancyapps/ui/dist/fancybox.css" media="print" onload='this.media="all"'><script>const GLOBAL_CONFIG={root:"/",algolia:void 0,localSearch:{path:"/search.xml",preload:!1,languages:{hits_empty:"找不到您查询的内容：${query}"}},translate:void 0,noticeOutdate:void 0,highlight:{plugin:"highlighjs",highlightCopy:!0,highlightLang:!0,highlightHeightLimit:!1},copy:{success:"吾辈宣布,你的剪切板已被占领",error:"呀~复制失败,请在尝试下",noSupport:"对不起,你的浏览器不支持"},relativeDate:{homepage:!1,post:!1},runtime:"",date_suffix:{just:"刚刚",min:"分钟前",hour:"小时前",day:"天前",month:"个月前"},copyright:{limitCount:60,languages:{author:"作者: XC's Blog",link:"链接: ",source:"来源: XC's Blog",info:"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},lightbox:"fancybox",Snackbar:{chs_to_cht:"您已切换为繁体",cht_to_chs:"您已切换为简体",day_to_night:"您已切换为深色主题",night_to_day:"您已切换为浅色主题",bgLight:"#3b70fc",bgDark:"#121212",position:"bottom-center"},source:{justifiedGallery:{js:"https://npm.elemecdn.com/flickr-justified-gallery/dist/fjGallery.min.js",css:"https://npm.elemecdn.com/flickr-justified-gallery/dist/fjGallery.css"}},isPhotoFigcaption:!1,islazyload:!0,isAnchor:!0}</script><script id="config-diff">var GLOBAL_CONFIG_SITE={title:"HTML与CSS进阶",isPost:!0,isHome:!1,isHighlightShrink:!1,isToc:!0,postUpdate:"2023-08-30 18:00:49"}</script><noscript><style>#nav{opacity:1}.justified-gallery img{opacity:1}#post-meta time,#recent-posts time{display:inline!important}</style></noscript><script>(e=>{e.saveToLocal={set:function(e,t,o){if(0===o)return;const n=864e5*o,a={value:t,expiry:(new Date).getTime()+n};localStorage.setItem(e,JSON.stringify(a))},get:function(e){const t=localStorage.getItem(e);if(!t)return;const o=JSON.parse(t);if(!((new Date).getTime()>o.expiry))return o.value;localStorage.removeItem(e)}},e.getScript=e=>new Promise(((t,o)=>{const n=document.createElement("script");n.src=e,n.async=!0,n.onerror=o,n.onload=n.onreadystatechange=function(){const e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(n.onload=n.onreadystatechange=null,t())},document.head.appendChild(n)})),e.activateDarkMode=function(){document.documentElement.setAttribute("data-theme","dark"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#0d0d0d")},e.activateLightMode=function(){document.documentElement.setAttribute("data-theme","light"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#ffffff")};const t=saveToLocal.get("theme");"dark"===t?activateDarkMode():"light"===t&&activateLightMode();const o=saveToLocal.get("aside-status");void 0!==o&&("hide"===o?document.documentElement.classList.add("hide-aside"):document.documentElement.classList.remove("hide-aside"));/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)&&document.documentElement.classList.add("apple")})(window)</script><link rel="stylesheet" href="https://cdn1.tianli0.top/gh/web-xc/My-blog-CSS/mgi.css"><link rel="stylesheet" href="https://cdn1.tianli0.top/gh/web-xc/My-blog-CSS/mg111.css"><link rel="stylesheet" href="https://npm.elemecdn.com/webxc@1.0.16/css/mg2.css"><link rel="stylesheet" href="https://npm.elemecdn.com/webxc@1.0.11/css/styless.css"><link rel="stylesheet" href="https://npm.elemecdn.com/webxc@1.0.11/css/styles.css"><link rel="stylesheet" href="https://npm.elemecdn.com/webxc@1.0.11/css/font.css"><link rel="stylesheet" href="https://npm.elemecdn.com/webxc@1.0.15/css/font2.css"><link rel="stylesheet" href="https://npm.elemecdn.com/webxc@1.0.12/css/swiper/swiper.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/webxc@1.0.12/css/swiper/swiperstyle.css" media="print" onload='this.media="all"'><meta name="generator" content="Hexo 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg" onerror='onerror=null,src="https://npm.elemecdn.com/webxc@1.0.2/banner/404.gif"' alt="avatar"></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">95</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">25</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">25</div></a></div><hr><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw iconfont icon-shouye"></i> <span>首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw iconfont icon-shijian"></i> <span>时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw iconfont icon-biaoqian"></i> <span>标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw iconfont icon-fenlei"></i> <span>分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw iconfont icon-lianxiwomen"></i> <span>友联</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw iconfont icon-iconzhengli-"></i> <span>关于</span></a></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);"><i class="fa-fw iconfont icon-a-wangzhanchaojilianjiehulianwang"></i> <span>推荐</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" target="_blank" rel="noopener" href="http://www.inode.club/"><i class="fa-fw fa-sharp fa-solid fa-square-rss"></i> <span>程序员指南</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="http://ife.baidu.com/"><i class="fa-fw fa-brands fa-vuejs"></i> <span>前端技术学园</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://www.yuque.com/tademanong/ag7q4n"><i class="fa-fw fa-solid fa-users"></i> <span>前端技术圈</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://www.code-nav.cn/"><i class="fa-fw fa-solid fa-shop"></i> <span>编程导航</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://q.shanyue.tech/"><i class="fa-fw fa-brands fa-square-js"></i> <span>每日一题</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://fanyouf.gitee.io/u1word/#/h5"><i class="fa-fw fa-solid fa-headphones"></i> <span>前端必会单词</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://site.51git.cn/render/gonav/4.html"><i class="fa-fw iconfont icon-wangzhandingzhi"></i> <span>网址导航</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://www.webxc.eu.org/music/"><i class="fa-fw iconfont icon-musical-note"></i> <span>音乐解锁</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image:url('https://npm.elemecdn.com/webxc@1.0.0/cover/html2.jpg')"><nav id="nav"><span id="blog_name"><div class="back-home-button" tabindex="-1"><i class="back-home-button-icon fas fa-grip-vertical"></i><div class="back-menu-list-groups"><div class="back-menu-list-group"><div class="back-menu-list-title">项目</div><div class="back-menu-list"><a class="back-menu-item" href="/" title="前往博客主页" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">主站</span></a><a class="back-menu-item" href="https://e.webxc.eu.org/" rel="external nofollow" title="前往学习笔记" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">学习笔记</span></a><a class="back-menu-item" href="https://v.webxc.eu.org/" rel="external nofollow" title="VuePress学习文档" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">VuePress文档</span></a><a class="back-menu-item" href="https://b.webxc.eu.org/" rel="external nofollow" title="旧站Hexo" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">旧站Hexo</span></a><a class="back-menu-item" href="https://gridea.webxc.eu.org/" rel="external nofollow" title="Gridea笔记" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">Gridea笔记</span></a><a class="back-menu-item" href="https://c.webxc.eu.org/" rel="external nofollow" title="魔改Hexo" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">魔改Hexo</span></a></div></div><div class="back-menu-list-group"><div class="back-menu-list-title">博客镜像</div><div class="back-menu-list"><a class="back-menu-item" href="https://blog.webxc.eu.org/" title="Vercel镜像" target="_blank" rel="noopener nofollow" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">Vercel镜像</span></a><a class="back-menu-item" href="https://webxc.tk/" title="Netlify镜像" target="_blank" rel="noopener nofollow" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">Netlify镜像</span></a><a class="back-menu-item" href="https://web-xc.gitee.io/" title="Gitee镜像" target="_blank" rel="noopener nofollow" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">Gitee镜像</span></a><a class="back-menu-item" href="https://cf.webxc.eu.org/" title="Cloudflare镜像" target="_blank" rel="noopener nofollow" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">Cloudflare镜像</span></a><a class="back-menu-item" href="https://render.webxc.eu.org/" title="Render镜像" target="_blank" rel="noopener nofollow" one-link-mark="yes"><img class="back-menu-item-icon" src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg"><span class="back-menu-item-text">Render镜像</span></a></div></div></div></div><a id="site-name" href="/"><div class="title">XC's Blog</div><i class="fa-solid fa-house"></i></a></span><div class="mask-name-container"><center id="name-container"><a id="page-name" href="javascript:btf.scrollToDest(0, 500)">PAGE_NAME</a></center></div><div id="menus"><div class="nav-button" id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i> <span>搜索</span></a></div><div class="nav-button" id="darkmode_navswitch"><a class="darkmode_switchbutton" type="button" title="浅色和深色模式转换" onclick="switchDarkMode()"><i class="fas fa-adjust"></i></a></div><div class="nav-button" id="nav-totop"><a class="totopbtn"><i class="fas fa-arrow-up"></i><span id="percent" onclick="btf.scrollToDest(0,500)">0</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw iconfont icon-shouye"></i> <span>首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw iconfont icon-shijian"></i> <span>时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw iconfont icon-biaoqian"></i> <span>标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw iconfont icon-fenlei"></i> <span>分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw iconfont icon-lianxiwomen"></i> <span>友联</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw iconfont icon-iconzhengli-"></i> <span>关于</span></a></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);"><i class="fa-fw iconfont icon-a-wangzhanchaojilianjiehulianwang"></i> <span>推荐</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" target="_blank" rel="noopener" href="http://www.inode.club/"><i class="fa-fw fa-sharp fa-solid fa-square-rss"></i> <span>程序员指南</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="http://ife.baidu.com/"><i class="fa-fw fa-brands fa-vuejs"></i> <span>前端技术学园</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://www.yuque.com/tademanong/ag7q4n"><i class="fa-fw fa-solid fa-users"></i> <span>前端技术圈</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://www.code-nav.cn/"><i class="fa-fw fa-solid fa-shop"></i> <span>编程导航</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://q.shanyue.tech/"><i class="fa-fw fa-brands fa-square-js"></i> <span>每日一题</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://fanyouf.gitee.io/u1word/#/h5"><i class="fa-fw fa-solid fa-headphones"></i> <span>前端必会单词</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://site.51git.cn/render/gonav/4.html"><i class="fa-fw iconfont icon-wangzhandingzhi"></i> <span>网址导航</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://www.webxc.eu.org/music/"><i class="fa-fw iconfont icon-musical-note"></i> <span>音乐解锁</span></a></li></ul></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">HTML与CSS进阶</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-01-03T18:00:00.000Z" title="发表于 2022-01-03 18:00:00">2022-01-03</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-08-30T18:00:49.041Z" title="更新于 2023-08-30 18:00:49">2023-08-30</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%89%8D%E7%AB%AF%E7%BB%8F%E9%AA%8C/">前端经验</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span data-flag-title="HTML与CSS进阶"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="twikoo_visitors"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h3 id="HTML与CSS进阶"><a href="#HTML与CSS进阶" class="headerlink" title="HTML与CSS进阶"></a>HTML与CSS进阶</h3><p>本文主要介绍H5新增内容以及CSS3中的新特性。在H5方面主要介绍拓展了哪些内容，CSS3方面介绍动画及转换。</p><h4 id="H5新增内容"><a href="#H5新增内容" class="headerlink" title="H5新增内容"></a>H5新增内容</h4><p><strong>「1. 什么是HTML5」</strong></p><ul><li><p>定义：<strong>HTML5</strong>定义了<strong>HTML</strong>标准的最新版本，是对<strong>HTML</strong>的第五次重大修改，号称下一代的HTML。</p></li><li><p>两个概念：</p></li><li><ul><li>是一个新版本的<strong>HTML</strong>语言，定义了新的标签、特性和属性</li><li>拥有一个强大的技术集，这些技术集是指：<strong>HTML5、CSS3、JavaScript</strong>,这也是广义上的HTML5。</li></ul></li></ul><p><strong>「2. HTML5拓展了哪些内容」</strong></p><ul><li>语义化标签</li><li>本地存储</li><li>兼容特性</li><li>2D、3D</li><li>动画、过渡</li><li>CSS3特性</li><li>性能与集成</li></ul><p><strong>「3. HTML5的现状」</strong></p><p>绝大多数新的属性，都已经被浏览器所支持，最新版本的浏览器已经开始陆续支持最新的特性，总的来说：HTML5已经是大势所趋。</p><h3 id="HTML5新增标签"><a href="#HTML5新增标签" class="headerlink" title="HTML5新增标签"></a>HTML5新增标签</h3><p><strong>「1. 什么是语义化」</strong></p><p>语义化是指用HTML写出符合<strong>内容的结构化</strong>（内容语义化），选择<strong>合适的标签</strong>（代码语义化），能够便于开发者阅读和写出更优雅的代码的同时让浏览器的爬虫和机器很好地解析。</p><p><strong>「2. 新增了哪些语义化标签」</strong></p><ul><li><code>header</code> — 头部标签</li><li><code>nav</code> — 导航标签</li><li><code>article</code> — 内容标签</li><li><code>section</code> — 块级标签</li><li><code>aside</code> — 侧边栏标签</li><li><code>footer</code> — 尾部标签</li></ul><p><img src="" data-lazy-src="" alt="图片"><strong>「3. 新增多媒体音频标签」</strong></p><ul><li><p>多媒体标签有两个，分别是音频 <strong>audio</strong>和视频<strong>video</strong>。</p></li><li><p><code>audio 标签说明</code></p></li><li><ul><li>可以在不使用标签的情况下，也能够原生的支持音频格式文件的播放，</li><li>但是：播放的格式是<strong>有限</strong>的。</li></ul></li><li><p><code>audio支持的音频格式</code></p></li></ul><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(6).png" alt="图片"></p><ul><li>audio 的参数</li></ul><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(5).png" alt="图片"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">&lt;audio controls&gt;</span><br><span class="line">    &lt;!-- 注意：在 chrome 浏览器中已经禁用了 autoplay 属性 --&gt;</span><br><span class="line">    &lt;!-- &lt;audio src=&quot;./media/snow.mp3&quot; controls autoplay&gt;&lt;/audio&gt; --&gt;</span><br><span class="line">    &lt;!-- </span><br><span class="line">    因为不同浏览器支持不同的格式，所以我们采取的方案是这个音频准备多个文件 --&gt;                             </span><br><span class="line">  &lt;source src=&quot;myAudio.mp3&quot; type=&quot;audio/mpeg&quot;&gt;</span><br><span class="line">  &lt;source src=&quot;myAudio.ogg&quot; type=&quot;audio/ogg&quot;&gt;</span><br><span class="line">  &lt;p&gt;Your browser doesn&#x27;t support HTML5 audio. Here is</span><br><span class="line">     a &lt;a href=&quot;myAudio.mp4&quot;&gt;link to the audio&lt;/a&gt; instead.&lt;/p&gt;</span><br><span class="line">&lt;/audio&gt;</span><br></pre></td></tr></table></figure><p><strong>「4. 新增多媒体视频标签」</strong></p><ul><li>video视频标签目前支持三种格式</li></ul><p><img src="" data-lazy-src="" alt="图片"></p><ul><li>语法格式</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;video src=&quot;./media/video.mp4&quot; controls=&quot;controls&quot;&gt;&lt;/video&gt;</span><br></pre></td></tr></table></figure><ul><li>video的参数</li></ul><p><img src="" data-lazy-src="" alt="图片"></p><ul><li>video代码演示</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">&lt;body&gt;</span><br><span class="line">  &lt;!-- &lt;video src=&quot;./media/video.mp4&quot; controls=&quot;controls&quot;&gt;&lt;/video&gt; --&gt;</span><br><span class="line"></span><br><span class="line">  &lt;!-- 谷歌浏览器禁用了自动播放功能，如果想自动播放，需要添加 muted 属性 --&gt;</span><br><span class="line">  &lt;video controls=&quot;controls&quot; autoplay muted loop poster=&quot;./media/pig.jpg&quot;&gt;</span><br><span class="line">    &lt;source src=&quot;./media/video.mp4&quot; type=&quot;video/mp4&quot;&gt;</span><br><span class="line">    &lt;source src=&quot;./media/video.ogg&quot; type=&quot;video/ogg&quot;&gt;</span><br><span class="line">  &lt;/video&gt;</span><br><span class="line">&lt;/body&gt;</span><br></pre></td></tr></table></figure><ul><li><p>多媒体标签总结</p></li><li><ul><li>音频标签和视频标签使用基本一致</li><li>多媒体标签在不同浏览器下情况不同，存在兼容性问题</li><li>谷歌浏览器把音频和视频标签的自动播放都<strong>禁止</strong>了</li><li>谷歌浏览器中视频添加<strong>muted</strong>属性就可以自己播放了</li><li>注意：重点记住使用方法及自动播放即可，其他属性在使用时查找对应的手册</li></ul></li></ul><p><strong>「5. 新增input标签」</strong></p><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(4).png" alt="图片"><strong>「6. 新增表单属性」</strong></p><p><img src="" data-lazy-src="" alt="图片"></p><h2 id="CSS3新增"><a href="#CSS3新增" class="headerlink" title="CSS3新增"></a>CSS3新增</h2><p><strong>「1. CSS3属性选择器」</strong></p><p><img src="" data-lazy-src="" alt="图片"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">button &#123;</span><br><span class="line">  cursor: pointer;</span><br><span class="line">&#125;</span><br><span class="line">button[disabled] &#123;</span><br><span class="line">  cursor: default;</span><br><span class="line">&#125;</span><br><span class="line">input[type=search] &#123;</span><br><span class="line">  color: skyblue;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">span[class^=black] &#123;</span><br><span class="line">  color: lightgreen;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">span[class$=black] &#123;</span><br><span class="line">  color: lightsalmon;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">span[class*=black] &#123;</span><br><span class="line">  color: lightseagreen;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><strong>「2. 结构伪类选择器」</strong></p><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(3).png" alt="图片"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">ul li:first-child &#123;</span><br><span class="line">  background-color: lightseagreen;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">ul li:last-child &#123;</span><br><span class="line">  background-color: lightcoral;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">ul li:nth-child(3) &#123;</span><br><span class="line">  background-color: aqua;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><ul><li><p>**nth-child(n)**参数n详解</p></li><li><ul><li>注意：本质上就是选中第几个子元素</li><li>n 可以是数字、关键字、公式</li><li>n 如果是数字，就是选中第几个</li><li>常见的关键字有 <code>even</code> 偶数、<code>odd</code> 奇数</li><li>常见的公式如下(如果 n 是公式，则从 0 开始计算)</li><li>但是第 0 个元素或者超出了元素的个数会被忽略</li></ul></li></ul><p><img src="" data-lazy-src="" alt="图片"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line">&lt;style&gt;</span><br><span class="line">  /* 偶数 */</span><br><span class="line">  ul li:nth-child(even) &#123;</span><br><span class="line">    background-color: aquamarine;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  /* 奇数 */</span><br><span class="line">  ul li:nth-child(odd) &#123;</span><br><span class="line">    background-color: blueviolet;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  /*n 是公式，从 0 开始计算 */</span><br><span class="line">  ul li:nth-child(n) &#123;</span><br><span class="line">    background-color: lightcoral;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  /* 偶数 */</span><br><span class="line">  ul li:nth-child(2n) &#123;</span><br><span class="line">    background-color: lightskyblue;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  /* 奇数 */</span><br><span class="line">  ul li:nth-child(2n + 1) &#123;</span><br><span class="line">    background-color: lightsalmon;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  /* 选择第 0 5 10 15, 应该怎么选 */</span><br><span class="line">  ul li:nth-child(5n) &#123;</span><br><span class="line">    background-color: orangered;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  /* n + 5 就是从第5个开始往后选择 */</span><br><span class="line">  ul li:nth-child(n + 5) &#123;</span><br><span class="line">    background-color: peru;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  /* -n + 5 前五个 */</span><br><span class="line">  ul li:nth-child(-n + 5) &#123;</span><br><span class="line">    background-color: tan;</span><br><span class="line">  &#125;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure><ul><li><p><code>nth-child与nth-of-type区别</code></p></li><li><ul><li><code>nth-child</code> 选择父元素里面的第几个子元素，不管是第几个类型</li><li><code>nth-of-type</code> 选择指定类型的元素</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">&lt;style&gt;</span><br><span class="line">  div :nth-child(1) &#123;</span><br><span class="line">    background-color: lightblue;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  div :nth-child(2) &#123;</span><br><span class="line">    background-color: lightpink;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  div span:nth-of-type(2) &#123;</span><br><span class="line">    background-color: lightseagreen;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  div span:nth-of-type(3) &#123;</span><br><span class="line">    background-color: #fff;</span><br><span class="line">  &#125;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure><p><strong>「3. 伪元素选择器」</strong></p><p><img src="" data-lazy-src="" alt="图片"></p><ul><li><p>伪元素选择器注意事项</p></li><li><ul><li><code>before</code> 和 <code>after</code> 必须有 <code>content</code> 属性</li><li><code>before</code> 在内容前面，after 在内容后面</li><li><code>before</code> 和 <code>after</code> 创建的是一个元素，但是属于行内元素</li><li>创建出来的元素在 <code>Dom</code> 中查找不到，所以称为伪元素</li><li>伪元素和标签选择器一样，权重为 1</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">&lt;style&gt;</span><br><span class="line">    div &#123;</span><br><span class="line">      width: 100px;</span><br><span class="line">      height: 100px;</span><br><span class="line">      border: 1px solid lightcoral;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    div::after,</span><br><span class="line">    div::before &#123;</span><br><span class="line">      width: 20px;</span><br><span class="line">      height: 50px;</span><br><span class="line">      text-align: center;</span><br><span class="line">      display: inline-block;</span><br><span class="line">    &#125;</span><br><span class="line">    div::after &#123;</span><br><span class="line">      content: &#x27;德&#x27;;</span><br><span class="line">      background-color: lightskyblue;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    div::before &#123;</span><br><span class="line">      content: &#x27;道&#x27;;</span><br><span class="line">      background-color: mediumaquamarine;</span><br><span class="line">    &#125;</span><br><span class="line">  &lt;/style&gt;</span><br></pre></td></tr></table></figure><h5 id="伪元素字体图标"><a href="#伪元素字体图标" class="headerlink" title="伪元素字体图标"></a>伪元素字体图标</h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">p &#123;</span><br><span class="line">   position: relative;</span><br><span class="line">   width: 220px;</span><br><span class="line">   height: 22px;</span><br><span class="line">   border: 1px solid lightseagreen;</span><br><span class="line">   margin: 60px;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line">p::after &#123;</span><br><span class="line">  content: &#x27;\ea50&#x27;;</span><br><span class="line">  font-family: &#x27;icomoon&#x27;;</span><br><span class="line">  position: absolute;</span><br><span class="line">  top: -1px;</span><br><span class="line">  right: 10px;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><strong>「4. 2D 转换之translate」</strong></p><ul><li><p><strong>2D转换</strong></p></li><li><ul><li><strong>2D</strong>转换是改变标签在二维平面上的位置和形状</li><li>移动：<strong>translate</strong></li><li>旋转：<strong>rotate</strong></li><li>缩放：<strong>scale</strong></li></ul></li><li><p>translate语法</p></li><li><ul><li>x就是X轴上水平移动</li><li>y就是y轴上水平移动</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">transform: translate(x, y)</span><br><span class="line">transform: translateX(n)</span><br><span class="line">transfrom: translateY(n)  </span><br></pre></td></tr></table></figure><ul><li><p>重点知识点</p></li><li><ul><li>2D的移动主要是指水平、垂直方向上的移动</li><li>translate最大的优点就是<strong>不影响</strong>其他元素的位置</li><li>translate中的100%单位，是相对于<strong>本身</strong>的宽度和高度来进行计算的</li><li>行内标签没有效果</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">div &#123;</span><br><span class="line">  background-color: lightseagreen;</span><br><span class="line">  width: 200px;</span><br><span class="line">  height: 100px;</span><br><span class="line">  /* 平移 */</span><br><span class="line">  /* 水平垂直移动 100px */</span><br><span class="line">  /* transform: translate(100px, 100px); */</span><br><span class="line"></span><br><span class="line">  /* 水平移动 100px */</span><br><span class="line">  /* transform: translate(100px, 0) */</span><br><span class="line"></span><br><span class="line">  /* 垂直移动 100px */</span><br><span class="line">  /* transform: translate(0, 100px) */</span><br><span class="line"></span><br><span class="line">  /* 水平移动 100px */</span><br><span class="line">  /* transform: translateX(100px); */</span><br><span class="line"></span><br><span class="line">  /* 垂直移动 100px */</span><br><span class="line">  transform: translateY(100px);</span><br><span class="line">  /*百分比用法*/</span><br><span class="line">  transform: translateY(100%);   </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><h5 id="让一个盒子水平垂直居中"><a href="#让一个盒子水平垂直居中" class="headerlink" title="让一个盒子水平垂直居中"></a>让一个盒子水平垂直居中</h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line">div &#123;</span><br><span class="line">    position: relative;</span><br><span class="line">    width: 500px;</span><br><span class="line">    height: 500px;</span><br><span class="line">    background-color: pink;</span><br><span class="line">    /* 1. 我们tranlate里面的参数是可以用 % */</span><br><span class="line">    /* 2. 如果里面的参数是 % 移动的距离是 盒子自身的宽度或者高度来对比的 */</span><br><span class="line">    /* 这里的 50% 就是 50px 因为盒子的宽度是 100px */</span><br><span class="line">    /* transform: translateX(50%); */</span><br><span class="line">    &#125;</span><br><span class="line">        </span><br><span class="line">p &#123;</span><br><span class="line">    position: absolute;</span><br><span class="line">    top: 50%;</span><br><span class="line">    left: 50%;</span><br><span class="line">    width: 200px;</span><br><span class="line">    height: 200px;</span><br><span class="line">    background-color: purple;</span><br><span class="line">    /1.* margin-top: -100px;</span><br><span class="line">    margin-left: -100px; */</span><br><span class="line">  </span><br><span class="line">    /2.* translate(-50%, -50%)  </span><br><span class="line">      盒子往上走自己高度的一半   */</span><br><span class="line">    transform: translate(-50%, -50%);</span><br><span class="line">  &#125;</span><br><span class="line">        </span><br><span class="line">span &#123;</span><br><span class="line">    /* translate 对于行内元素是无效的 */</span><br><span class="line">    transform: translate(300px, 300px);</span><br><span class="line">     &#125;</span><br></pre></td></tr></table></figure><p><strong>「5. 2D 转换之rotate」</strong></p><ul><li><p><strong>rotate</strong>旋转</p></li><li><ul><li>2D旋转指的是让元素在二维平面内顺时针或者逆时针旋转</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">/* 单位是：deg */</span><br><span class="line">img:hover &#123;</span><br><span class="line">  transform: rotate(360deg)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><ul><li><p>rotate语法</p></li><li><ul><li><code>rotate</code> 里面跟度数，单位是 <code>deg</code></li><li>角度为<strong>正</strong>时，顺时针，角度为负时，逆时针</li><li>默认旋转的中心点是元素的中心点</li></ul></li><li><p><strong>设置元素旋转的中心的(transform-origin)</strong></p></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">transform-origin: x y;</span><br></pre></td></tr></table></figure><ul><li><p><code>注意</code></p></li><li><ul><li>后面的参数 x 和 y 用空格隔开</li><li>x y 默认旋转的中心点是元素的中心(50% 50%),等价于<strong>center center</strong></li><li>还可以给x y 设置像素或者方位名词(top、bottom、left、right、center)</li></ul></li></ul><p><strong>「6. 2D 转换之scale」</strong></p><ul><li><strong>scale</strong>的作用：用来控制元素的放大与缩小</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">transform: scale(x, y)</span><br></pre></td></tr></table></figure><ul><li><p><code>知识要点：</code></p></li><li><ul><li>注意，x与y之间用逗号进行分隔</li><li><code>transform: scale(1, 1)</code>: 宽高都放大一倍，相当于没有放大</li><li><code>transform: scale(2, 2)</code>: 宽和高都放大了二倍</li><li><code>transform: scale(2)</code>: 如果只写了一个参数，第二个参数就和第一个参数一致</li><li><code>transform:scale(0.5, 0.5)</code>: 缩小</li><li><code>scale</code> 最大的优势：可以设置转换中心点缩放，默认以中心点缩放，而且不影响其他盒子</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">div:hover &#123;</span><br><span class="line"> /* 注意，数字是倍数的含义，所以不需要加单位 */</span><br><span class="line"> /* transform: scale(2, 2) */</span><br><span class="line"></span><br><span class="line"> /* 实现等比缩放，同时修改宽与高 */</span><br><span class="line"> /* transform: scale(2) */</span><br><span class="line"></span><br><span class="line"> /* 小于 1 就等于缩放*/</span><br><span class="line"> transform: scale(0.5, 0.5)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><strong>「7. 2D 转换综合写法以及顺序问题」</strong></p><h5 id="知识要点"><a href="#知识要点" class="headerlink" title="知识要点"></a>知识要点</h5><ul><li>同时使用多个转换，其格式为 <code>transform: translate() rotate() scale()</code></li><li>顺序会影响到转换的效果(先旋转会改变坐标轴方向)</li><li>当我们同时有位置或者其他属性的时候，要将位移放到最前面</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">div:hover &#123;</span><br><span class="line">  transform: translate(200px, 0) rotate(360deg) scale(1.2)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><h3 id="动画-animation"><a href="#动画-animation" class="headerlink" title="动画(animation)"></a>动画(animation)</h3><p><strong>「动画」</strong>是CSS3中最具颠覆性的特征之一，可通过设置多个节点来精确的控制一个或者一组动画，从而实现复杂的动画效果。</p><p><strong>「动画的使用」</strong></p><ol><li>先<strong>定义</strong>动画</li><li>再<strong>调用</strong>定义好的动画</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">/*1. 定义动画*/</span><br><span class="line">@keyframes 动画名称 &#123;</span><br><span class="line">    0% &#123;</span><br><span class="line">        width: 100px;</span><br><span class="line">    &#125;</span><br><span class="line">    100% &#123;</span><br><span class="line">        width: 200px</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line">div &#123;</span><br><span class="line"> /* 调用动画 */</span><br><span class="line">  animation-name: 动画名称;</span><br><span class="line">  /* 持续时间 */</span><br><span class="line">  animation-duration: 持续时间；</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><strong>「动画序列」</strong></p><ul><li>0% 是动画的开始，100 % 是动画的完成，这样的规则就是<strong>动画序列</strong></li><li>在 <strong>@keyframs</strong>中规定某项 CSS 样式，就由创建当前样式<strong>逐渐</strong>改为新样式的动画效果</li><li>动画是使元素从一个样式逐渐变化为另一个样式的效果，可以改变任意多的样式任意多的次数</li><li>用百分比来规定变化发生的时间，或用 <code>from</code> 和 <code>to</code>，等同于 0% 和 100%</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">&lt;style&gt;</span><br><span class="line">    div &#123;</span><br><span class="line">      width: 100px;</span><br><span class="line">      height: 100px;</span><br><span class="line">      background-color: aquamarine;</span><br><span class="line">      animation-name: move;</span><br><span class="line">      animation-duration: 0.5s;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    @keyframes move&#123;</span><br><span class="line">      0% &#123;</span><br><span class="line">        transform: translate(0px)</span><br><span class="line">      &#125;</span><br><span class="line">      100% &#123;</span><br><span class="line">        transform: translate(500px, 0)</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &lt;/style&gt;</span><br></pre></td></tr></table></figure><p><strong>「动画常见属性」</strong></p><p><img src="" data-lazy-src="" alt="图片"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">div &#123;</span><br><span class="line">  width: 100px;</span><br><span class="line">  height: 100px;</span><br><span class="line">  background-color: aquamarine;</span><br><span class="line">  /* 动画名称 */</span><br><span class="line">  animation-name: move;</span><br><span class="line">  /* 动画花费时长 */</span><br><span class="line">  animation-duration: 2s;</span><br><span class="line">  /* 动画速度曲线 */</span><br><span class="line">  animation-timing-function: ease-in-out;</span><br><span class="line">  /* 动画等待多长时间执行 */</span><br><span class="line">  animation-delay: 2s;</span><br><span class="line">  /* 规定动画播放次数 infinite: 无限循环 */</span><br><span class="line">  animation-iteration-count: infinite;</span><br><span class="line">  /* 是否逆行播放 */</span><br><span class="line">  animation-direction: alternate;</span><br><span class="line">  /* 动画结束之后的状态 */</span><br><span class="line">  animation-fill-mode: forwards;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">div:hover &#123;</span><br><span class="line">  /* 规定动画是否暂停或者播放 */</span><br><span class="line">  animation-play-state: paused;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><strong>「动画简写方式」</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">/* animation: 动画名称 持续时间 运动曲线 何时开始 播放次数 是否反方向 起始与结束状态 */</span><br><span class="line">animation: name duration timing-function delay iteration-count direction fill-mode</span><br></pre></td></tr></table></figure><p><strong>知识要点</strong></p><ul><li>简写属性里面不包含 <code>animation-paly-state</code></li><li>暂停动画 <code>animation-paly-state: paused</code>; 经常和鼠标经过等其他配合使用</li><li>要想动画走回来，而不是直接调回来：<code>animation-direction: alternate</code></li><li>盒子动画结束后，停在结束位置：<code>animation-fill-mode: forwards</code></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">animation: move 2s linear 1s infinite alternate forwards;</span><br></pre></td></tr></table></figure><p><strong>「速度曲线细节」</strong></p><p><code>animation-timing-function</code>: 规定动画的速度曲线，默认是<strong>ease</strong></p><p><img src="" data-lazy-src="" alt="图片"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">/*打字机效果*/</span><br><span class="line">div &#123;</span><br><span class="line">  width: 0px;</span><br><span class="line">  height: 50px;</span><br><span class="line">  line-height: 50px;</span><br><span class="line">  white-space: nowrap;</span><br><span class="line">  overflow: hidden;</span><br><span class="line">  background-color: aquamarine;</span><br><span class="line">  animation: move 4s steps(24) forwards;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@keyframes move &#123;</span><br><span class="line">  0% &#123;</span><br><span class="line">    width: 0px;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  100% &#123;</span><br><span class="line">    width: 480px;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><h3 id="CSS-过渡transition"><a href="#CSS-过渡transition" class="headerlink" title="CSS 过渡transition"></a>CSS 过渡transition</h3><p>通过过渡<strong>transition</strong>，可以让web前端开发人员不需要javascript就可以实现简单的动画交互效果。</p><blockquote><p><code>深入理解CSS过渡transition</code><br><a target="_blank" rel="noopener" href="https://www.cnblogs.com/xiaohuochai/p/5347930.html">https://www.cnblogs.com/xiaohuochai/p/5347930.html</a></p></blockquote><p><strong>「定义」</strong>过渡transition是一个复合属性，包括<strong>transition-property</strong>、<strong>transition-duration</strong>、<strong>transition-timing-function</strong>、<strong>transition-delay</strong>这四个子属性。通过这四个子属性的配合来完成一个完整的过渡效果。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">transition-property: 过渡属性(默认值为all)</span><br><span class="line">transition-duration: 过渡持续时间(默认值为0s)</span><br><span class="line">transiton-timing-function: 过渡函数(默认值为ease函数)</span><br><span class="line">transition-delay: 过渡延迟时间(默认值为0s)</span><br><span class="line">.test&#123;</span><br><span class="line">    height: 100px;</span><br><span class="line">    width: 100px;</span><br><span class="line">    background-color: pink;</span><br><span class="line">    transition-duration: 3s;</span><br><span class="line">/*     以下三值为默认值，稍后会详细介绍 */</span><br><span class="line">    transition-property: all;</span><br><span class="line">    transition-timing-function: ease;</span><br><span class="line">    transition-delay: 0s;</span><br><span class="line">&#125;    </span><br><span class="line">.test:hover&#123;</span><br><span class="line">    width: 500px;</span><br><span class="line">&#125;</span><br><span class="line">~~~html</span><br><span class="line">&lt;div class=&quot;test&quot;&gt;&lt;/div&gt;</span><br></pre></td></tr></table></figure><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(2).gif" alt="图片"></p><p><strong>「复合属性」</strong>过渡transition的这四个子属性只有<transition-duration>是必需且不能为0。其中，<transition-duration>和<transition-delay>都是时间。当两个时间同时出现时，第一个是<transition-duration>，第二个是<transition-delay>；当只有一个时间时，它是<transition-duration>，而<transition-delay>为默认值0s</transition-delay></transition-duration></transition-delay></transition-duration></transition-delay></transition-duration></transition-duration></p><ul><li><p><strong>注意:</strong></p></li><li><ul><li>transition的这四个子属性之间不能用逗号隔开，只能用空格隔开。因为逗号隔开的代表不同的属性(transition属性支持多值，多值部分稍后介绍)；而空格隔开的代表不同属性的四个关于过渡的子属性。</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">.test&#123;</span><br><span class="line">    height: 100px;</span><br><span class="line">    width: 100px;</span><br><span class="line">    background-color: pink;</span><br><span class="line">/*代表持续时间为2s，延迟时间为默认值0s*/</span><br><span class="line">    transition；2s;</span><br><span class="line">&#125;    </span><br><span class="line">.test:hover&#123;</span><br><span class="line">    width: 500px;</span><br><span class="line">&#125;</span><br><span class="line">&lt;div class=&quot;test&quot;&gt;&lt;/div&gt;</span><br></pre></td></tr></table></figure><p><img src="" data-lazy-src="" alt="图片"><code>延迟时间delay 案例</code></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">.test&#123;</span><br><span class="line">    height: 100px;</span><br><span class="line">    width: 100px;</span><br><span class="line">    background-color: pink;</span><br><span class="line">    /*代表持续时间为1s，延迟时间为2s*/</span><br><span class="line">    transition: 1s 2s;</span><br><span class="line">&#125;    </span><br><span class="line">.test:hover&#123;</span><br><span class="line">    width: 500px;</span><br><span class="line">&#125;</span><br><span class="line">&lt;div class=&quot;test&quot;&gt;&lt;/div&gt;</span><br></pre></td></tr></table></figure><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(1).gif" alt="图片"></p><p><strong>「过渡属性」</strong></p><ul><li>值: none | all |<transition-property>[,<transition-property>]</transition-property></transition-property></li><li>初始值: all</li><li>应用于: 所有元素</li><li>继承性: 无</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">none: 没有指定任何样式</span><br><span class="line">all: 默认值，表示指定元素所有支持transition-property属性的样式</span><br><span class="line">&lt;transition-property&gt;: 可过渡的样式，可用逗号分开写多个样式</span><br></pre></td></tr></table></figure><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(3).gif" alt="图片"></p><p><strong>「过渡持续时间」</strong></p><ul><li>值: <time>[,<time>]*</time></time></li><li>初始值: 0s</li><li>应用于: 所有元素</li><li>继承性: 无</li><li>[注意]该属性不能为负值</li><li>[注意]若该属性为0s则为默认值，若为0则为无效值。所以必须<strong>带单位</strong></li><li>[注意]该值为单值时，即所有过渡属性都对应同样时间；该值为多值时，过渡属性按照顺序对应持续时间</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">/*DEMO中的过渡属性值*/</span><br><span class="line">transition-property: width,background;</span><br></pre></td></tr></table></figure><p><img src="" data-lazy-src="" alt="图片"><strong>「过渡时间函数」</strong></p><p><strong>过渡时间函数</strong>用于定义元素过渡属性随时间变化的过渡速度变化效果</p><ul><li>值:<timing-function>[,<timing-function>]*</timing-function></timing-function></li><li>初始值: <strong>ease</strong></li><li>应用于: 所有元素</li><li>继承性: 无</li></ul><p><strong>「取值」</strong> 过渡时间函数共三种取值，分别是<strong>关键字</strong>、<strong>steps函数</strong>和<strong>bezier函数</strong></p><p><strong>「关键字」</strong>其实是bezier函数或steps函数的特殊值</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">ease: 开始和结束慢，中间快。</span><br><span class="line">linear: 匀速。</span><br><span class="line">ease-in: 开始慢。</span><br><span class="line">ease-out: 结束慢。</span><br><span class="line">ease-in-out: 和ease类似，但比ease幅度大。</span><br></pre></td></tr></table></figure><hr><h2 id="3D转换"><a href="#3D转换" class="headerlink" title="3D转换"></a>3D转换</h2><h3 id="认识3D转换"><a href="#认识3D转换" class="headerlink" title="认识3D转换"></a>认识3D转换</h3><p><strong>「3D的特点」</strong>近大远小，物体和面遮挡不可见</p><p><strong>「三维坐标系」</strong></p><ul><li>x 轴：水平向右 – <code>注意：x 轴右边是正值，左边是负值</code></li><li>y 轴：垂直向下 – <code>注意：y 轴下面是正值，上面是负值</code></li><li>z 轴：垂直屏幕 – <code>注意：往外边的是正值，往里面的是负值</code></li></ul><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(2).png" alt="图片"></p><h3 id="3D转换-1"><a href="#3D转换-1" class="headerlink" title="3D转换"></a>3D转换</h3><p><strong>1. 3D 转换知识要点</strong></p><ul><li><code>3D</code> 位移：<code>translate3d(x, y, z)</code></li><li><code>3D</code> 旋转：<code>rotate3d(x, y, z)</code></li><li><code>透视</code> ：<code>perspctive</code></li><li><code>3D</code>呈现 <code>transfrom-style</code></li></ul><p><strong>2. 3D 移动translate3d</strong></p><ul><li><code>3D</code> 移动就是在 <code>2D</code> 移动的基础上多加了一个可以移动的方向，就是 z 轴方向</li><li><code>transform: translateX(100px)</code>：仅仅是在 x 轴上移动</li><li><code>transform: translateY(100px)</code>：仅仅是在 y 轴上移动</li><li><code>transform: translateZ(100px)</code>：仅仅是在 z 轴上移动</li><li><code>transform: translate3d(x, y, z)</code>：其中x、y、z 分别指要移动的轴的方向的距离</li><li><code>注意：x, y, z 对应的值不能省略，不需要填写用 0 进行填充</code></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">transform: translate3d(100px, 100px, 100px)</span><br><span class="line">/* 注意：x, y, z 对应的值不能省略，不需要填写用 0 进行填充 */</span><br><span class="line">transform: translate3d(100px, 100px, 0)</span><br></pre></td></tr></table></figure><h3 id="透视perspective"><a href="#透视perspective" class="headerlink" title="透视perspective"></a>透视perspective</h3><ul><li><p>知识点讲解</p></li><li><ul><li>如果想要网页产生 <code>3D</code> 效果需要透视(理解成 <code>3D</code> 物体投影的 <code>2D</code> 平面上)</li><li>实际上模仿人类的视觉位置，可视为安排一只眼睛去看</li><li>透视也称为视距，所谓的视距就是人的眼睛到屏幕的距离</li><li>距离视觉点越近的在电脑平面成像越大，越远成像越小</li><li>透视的单位是像素</li></ul></li><li><p>知识要点</p></li><li><ul><li><strong>透视需要写在被视察元素的父盒子上面</strong></li><li>注意下方图片</li><li>d：就是视距，视距就是指人的眼睛到屏幕的距离</li><li>z：就是 z 轴，z 轴越大(正值)，我们看到的物体就越大</li></ul></li></ul><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(1).png" alt="图片">代码演示</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">body &#123;</span><br><span class="line">  /*透视需要写在被视察元素的父盒子上面 */</span><br><span class="line">  perspective: 1000px;</span><br><span class="line">&#125;</span><br><span class="line">translateZ与perspective的区别</span><br></pre></td></tr></table></figure><ul><li><code>perspecitve</code> 给父级进行设置视距的，<code>translateZ</code> 给 子元素进行设置不同的大小</li></ul><h3 id="3D-旋转rotateX"><a href="#3D-旋转rotateX" class="headerlink" title="3D 旋转rotateX"></a>3D 旋转rotateX</h3><p><strong>3D 旋转</strong>指可以让元素在三维平面内沿着 x 轴、y 轴、z 轴 或者自定义轴进行旋转</p><ul><li><p><code>语法：</code></p></li><li><ul><li><strong>transform: rotateX(45deg)</strong> – 沿着 x 轴正方向旋转 45 度</li><li><strong>transform: rotateY(45deg)</strong> – 沿着 y 轴正方向旋转 45 度</li><li><strong>transform: rotateZ(45deg)</strong> – 沿着 z 轴正方向旋转 45 度</li><li><strong>transform: rotate3d(x, y, z, 45deg)</strong> – 沿着自定义轴旋转 45 deg 为角度</li></ul></li><li><p><code>左手法则：</code></p></li><li><ul><li>左手的手拇指指向 x 轴的正方向</li><li>其余手指的弯曲方向就是该元素沿着 x 轴旋转的方向</li></ul></li></ul><p><img src="" data-lazy-src="" alt="图片"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">div &#123;</span><br><span class="line">  /*透视写在被视察元素的父盒子上面 */</span><br><span class="line">  perspective: 300px;</span><br><span class="line">&#125;</span><br><span class="line">/*被观察元素*/</span><br><span class="line">img &#123;</span><br><span class="line">  display: block;</span><br><span class="line">  margin: 100px auto;</span><br><span class="line">  transition: all 1s;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">img:hover &#123;</span><br><span class="line">  transform: rotateX(-45deg)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><h3 id="3D-旋转rotateY"><a href="#3D-旋转rotateY" class="headerlink" title="3D 旋转rotateY"></a>3D 旋转rotateY</h3><ul><li><p><code>左手法则：</code></p></li><li><ul><li>左手的拇指指向 y 轴的正方向</li><li>其余的手指弯曲方向就是该元素沿着 y 轴旋转的方向(正值)</li></ul></li></ul><p><img src="" data-lazy-src="https://cdn1.tianli0.top/gh/web-xc/iMG/posts/html5%20(7).png" alt="图片"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">div &#123;</span><br><span class="line">  perspective: 500px;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">img &#123;</span><br><span class="line">  display: block;</span><br><span class="line">  margin: 100px auto;</span><br><span class="line">  transition: all 1s;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">img:hover &#123;</span><br><span class="line">  transform: rotateY(180deg)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><h3 id="3D-旋转rotateZ"><a href="#3D-旋转rotateZ" class="headerlink" title="3D 旋转rotateZ"></a>3D 旋转rotateZ</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">div &#123;</span><br><span class="line">  perspective: 500px;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">img &#123;</span><br><span class="line">  display: block;</span><br><span class="line">  margin: 100px auto;</span><br><span class="line">  transition: all 1s;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">img:hover &#123;</span><br><span class="line">  transform: rotateZ(180deg)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><strong>「rotate3d」</strong></p><ul><li><p><strong>transform: rotate3d(x, y, z, deg)</strong> – 沿着自定义轴旋转 deg 为角度</p></li><li><p>x, y, z 表示旋转轴的矢量，是标识你是否希望沿着该轴进行旋转，最后一个标识旋转的角度</p></li><li><ul><li><strong>transform: rotate3d(1, 1, 0, 180deg)</strong> – 沿着对角线旋转 45deg</li><li><strong>transform: rotate3d(1, 0, 0, 180deg)</strong> – 沿着 x 轴旋转 45deg</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">div &#123;</span><br><span class="line">  perspective: 500px;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">img &#123;</span><br><span class="line">  display: block;</span><br><span class="line">  margin: 100px auto;</span><br><span class="line">  transition: all 1s;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">img:hover &#123;</span><br><span class="line">  transform: rotate3d(1, 1, 0, 180deg)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><h3 id="3D呈现transform-style"><a href="#3D呈现transform-style" class="headerlink" title="3D呈现transform-style"></a>3D呈现transform-style</h3><ul><li>控制子元素是否开启三维立体环境</li><li><code>transform-style: flat</code> 代表子元素不开启 <code>3D</code> 立体空间，默认的</li><li><code>transform-style: preserve-3d</code> 子元素开启立体空间</li><li>代码写给父级，但是影响的是子盒子</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">&lt;body&gt;</span><br><span class="line">    &lt;div class=&quot;box&quot;&gt;</span><br><span class="line">        &lt;div&gt;&lt;/div&gt;</span><br><span class="line">        &lt;div&gt;&lt;/div&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">&lt;/body&gt;</span><br><span class="line">&lt;style&gt;</span><br><span class="line">    body &#123;</span><br><span class="line">        perspective: 500px;</span><br><span class="line">        &#125;</span><br><span class="line">        </span><br><span class="line">    .box &#123;</span><br><span class="line">        position: relative;</span><br><span class="line">        width: 200px;</span><br><span class="line">        height: 200px;</span><br><span class="line">        margin: 100px auto;</span><br><span class="line">        transition: all 2s;</span><br><span class="line">        /* 让子元素保持3d立体空间环境 */</span><br><span class="line">        transform-style: preserve-3d;</span><br><span class="line">        &#125;</span><br><span class="line">        </span><br><span class="line">    .box:hover &#123;</span><br><span class="line">        transform: rotateY(60deg);</span><br><span class="line">    &#125;</span><br><span class="line">        </span><br><span class="line">    .box div &#123;</span><br><span class="line">        position: absolute;</span><br><span class="line">        top: 0;</span><br><span class="line">        left: 0;</span><br><span class="line">        width: 100%;</span><br><span class="line">        height: 100%;</span><br><span class="line">        background-color: pink;</span><br><span class="line">    &#125;</span><br><span class="line">        </span><br><span class="line">    .box div:last-child &#123;</span><br><span class="line">        background-color: purple;</span><br><span class="line">        transform: rotateX(60deg);</span><br><span class="line">    &#125;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">本文作者:</span> <span class="post-copyright-info"><a href="https://webxc.eu.org">XC's Blog</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">本文链接:</span> <span class="post-copyright-info"><a href="https://webxc.eu.org/post/598947694/">https://webxc.eu.org/post/598947694/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明:</span> <span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://webxc.eu.org" target="_blank">XC's Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E5%89%8D%E7%AB%AF%E7%BB%8F%E9%AA%8C/">前端经验</a></div><div class="post_share"><div class="social-share" data-image="https://npm.elemecdn.com/webxc@1.0.0/cover/html2.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://npm.elemecdn.com/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload='this.media="all"'><script src="https://npm.elemecdn.com/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://npm.elemecdn.com/webxc@1.0.0/lxfs/wechat.png" target="_blank"><img class="post-qr-code-img" src="https://npm.elemecdn.com/webxc@1.0.0/lxfs/wechat.png" alt="Wechat"></a><div class="post-qr-code-desc">Wechat</div></li><li class="reward-item"><a href="https://npm.elemecdn.com/webxc@1.0.0/lxfs/alipay.jpg" target="_blank"><img class="post-qr-code-img" src="https://npm.elemecdn.com/webxc@1.0.0/lxfs/alipay.jpg" alt="Alipay"></a><div class="post-qr-code-desc">Alipay</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/post/465190731/"><img class="prev-cover" src="https://npm.elemecdn.com/webxc@1.0.0/cover/vuex.jpg" onerror='onerror=null,src="https://npm.elemecdn.com/webxc@1.0.2/banner/404.gif"' alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇文章</div><div class="prev_info">VueX-数组对象的双向数据绑定</div></div></a></div><div class="next-post pull-right"><a href="/post/2847555892/"><img class="next-cover" src="https://npm.elemecdn.com/webxc@1.0.0/cover/js1.jpg" onerror='onerror=null,src="https://npm.elemecdn.com/webxc@1.0.2/banner/404.gif"' alt="cover of next post"><div class="pagination-info"><div class="label">下一篇文章</div><div class="next_info">JavaScript基础</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/post/3363282404/" title="CSS属性大全"><img class="cover" src="https://npm.elemecdn.com/webxc@1.0.0/cover/css1.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-01-30</div><div class="title">CSS属性大全</div></div></a></div><div><a href="/post/404922574/" title="CSS笔记"><img class="cover" src="https://npm.elemecdn.com/webxc@1.0.0/cover/css1.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-08-02</div><div class="title">CSS笔记</div></div></a></div><div><a href="/post/3782454218/" title="HTML基础"><img class="cover" src="https://npm.elemecdn.com/webxc@1.0.0/cover/cover8.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-12-01</div><div class="title">HTML基础</div></div></a></div></div></div><hr><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i> <span>评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg" onerror='this.onerror=null,this.src="https://npm.elemecdn.com/webxc@1.0.2/banner/404.gif"' alt="avatar"></div><div class="author-info__name">XC's Blog</div><div class="author-info__description">XC's Blog 记录生活和学习文章</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">95</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">25</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">25</div></a></div><div class="card-info-social-icons is-center"><a class="social-icon" href="https://tenapi.cn/qqzlk/?qq=2848141597" target="_blank" title="QQ"><i class="iconfont icon-QQ"></i></a><a class="social-icon" href="https://npm.elemecdn.com/webxc@1.0.0/lxfs/wechat.jpg" target="_blank" title="微信"><i class="iconfont icon-weixin"></i></a><a class="social-icon" href="https://github.com/web-xc" target="_blank" title="Github"><i class="iconfont icon-github"></i></a><a class="social-icon" href="https://space.bilibili.com/2134826455" target="_blank" title="BiliBili"><i class="iconfont icon-bilibili"></i></a><a class="social-icon" href="https://music.163.com/#/user/home?id=323682437" target="_blank" title="网易云音乐"><i class="iconfont icon-wyy"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">原网站因使用.ml域名被回收, 再加上本人因学习原因, 没怎么打理博客, 使用了https://webxc.eu.org域名来维持博客运行, 如果有加友联的朋友们, 去友联页看信息即可, 如果原来有加过的, 麻烦在原来域名后缀改一下(.ml ==> .eu.org)就行, 博客写的太乱了, 没时间打理, 兄弟们谅解😁😁~~</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#HTML%E4%B8%8ECSS%E8%BF%9B%E9%98%B6"><span class="toc-number">1.</span> <span class="toc-text">HTML与CSS进阶</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#H5%E6%96%B0%E5%A2%9E%E5%86%85%E5%AE%B9"><span class="toc-number">1.1.</span> <span class="toc-text">H5新增内容</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#HTML5%E6%96%B0%E5%A2%9E%E6%A0%87%E7%AD%BE"><span class="toc-number">2.</span> <span class="toc-text">HTML5新增标签</span></a></li></ol><li class="toc-item toc-level-2"><a class="toc-link" href="#CSS3%E6%96%B0%E5%A2%9E"><span class="toc-number"></span> <span class="toc-text">CSS3新增</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E4%BC%AA%E5%85%83%E7%B4%A0%E5%AD%97%E4%BD%93%E5%9B%BE%E6%A0%87"><span class="toc-number">0.0.1.</span> <span class="toc-text">伪元素字体图标</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E8%AE%A9%E4%B8%80%E4%B8%AA%E7%9B%92%E5%AD%90%E6%B0%B4%E5%B9%B3%E5%9E%82%E7%9B%B4%E5%B1%85%E4%B8%AD"><span class="toc-number">0.0.2.</span> <span class="toc-text">让一个盒子水平垂直居中</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E7%9F%A5%E8%AF%86%E8%A6%81%E7%82%B9"><span class="toc-number">0.0.3.</span> <span class="toc-text">知识要点</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB-animation"><span class="toc-number">1.</span> <span class="toc-text">动画(animation)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#CSS-%E8%BF%87%E6%B8%A1transition"><span class="toc-number">2.</span> <span class="toc-text">CSS 过渡transition</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3D%E8%BD%AC%E6%8D%A2"><span class="toc-number"></span> <span class="toc-text">3D转换</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AE%A4%E8%AF%863D%E8%BD%AC%E6%8D%A2"><span class="toc-number">1.</span> <span class="toc-text">认识3D转换</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3D%E8%BD%AC%E6%8D%A2-1"><span class="toc-number">2.</span> <span class="toc-text">3D转换</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%80%8F%E8%A7%86perspective"><span class="toc-number">3.</span> <span class="toc-text">透视perspective</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3D-%E6%97%8B%E8%BD%ACrotateX"><span class="toc-number">4.</span> <span class="toc-text">3D 旋转rotateX</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3D-%E6%97%8B%E8%BD%ACrotateY"><span class="toc-number">5.</span> <span class="toc-text">3D 旋转rotateY</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3D-%E6%97%8B%E8%BD%ACrotateZ"><span class="toc-number">6.</span> <span class="toc-text">3D 旋转rotateZ</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3D%E5%91%88%E7%8E%B0transform-style"><span class="toc-number">7.</span> <span class="toc-text">3D呈现transform-style</span></a></li></ol></li></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/post/ds2s/" title="整个前端面试题"><img src="https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png" onerror='this.onerror=null,this.src="https://npm.elemecdn.com/webxc@1.0.2/banner/404.gif"' alt="整个前端面试题"></a><div class="content"><a class="title" href="/post/ds2s/" title="整个前端面试题">整个前端面试题</a><time datetime="2023-08-31T02:00:00.000Z" title="发表于 2023-08-31 02:00:00">2023-08-31</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/ds23/" title="常见前端面试题"><img src="https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png" onerror='this.onerror=null,this.src="https://npm.elemecdn.com/webxc@1.0.2/banner/404.gif"' alt="常见前端面试题"></a><div class="content"><a class="title" href="/post/ds23/" title="常见前端面试题">常见前端面试题</a><time datetime="2023-08-28T18:30:00.000Z" title="发表于 2023-08-28 18:30:00">2023-08-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/fe33/" title="硅谷甄选运营平台"><img src="https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png" onerror='this.onerror=null,this.src="https://npm.elemecdn.com/webxc@1.0.2/banner/404.gif"' alt="硅谷甄选运营平台"></a><div class="content"><a class="title" href="/post/fe33/" title="硅谷甄选运营平台">硅谷甄选运营平台</a><time datetime="2023-07-26T03:55:00.000Z" title="发表于 2023-07-26 03:55:00">2023-07-26</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2021 - 2023 By XC's Blog</div><div class="framework-info"><span></span> <a target="_blank" rel="noopener" href="https://icp.gov.moe/?keyword=20235221">萌ICP备20235221号</a><span class="footer-separator">|</span><span></span> <a target="_blank" rel="noopener" href="https://icp.gov.moe/">萌ICP查询</a><div id="running-time"></div></div><script>setInterval((()=>{let e=Math.round(new Date("2021-11-21 01:35:06").getTime()/1e3),t=Math.round(((new Date).getTime()+288e5)/1e3)-e,n=new Array(0,0,0,0,0);t>=31536e3&&(n[0]=parseInt(t/31536e3),t%=31536e3),t>=86400&&(n[1]=parseInt(t/86400),t%=86400),t>=3600&&(n[2]=parseInt(t/3600),t%=3600),t>=60&&(n[3]=parseInt(t/60),t%=60),t>0&&(n[4]=t),currentTimeHtml="本站已安全运行 "+n[0]+" 年 "+n[1]+" 天 "+n[2]+" 时 "+n[3]+" 分 "+n[4]+" 秒",document.getElementById("running-time").innerHTML=currentTimeHtml}),1e3)</script></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i><span id="percent">0<span>%</span></span></button><button id="go-down" type="button" title="直达底部" onclick="btf.scrollToDest(document.body.scrollHeight,500)"><i class="fas fa-arrow-down"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i> <span>正在载入文件,请稍后</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"></div></div><hr><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="https://npm.elemecdn.com/hexo-theme-butterfly/source/js/utils.js"></script><script src="https://npm.elemecdn.com/hexo-theme-butterfly@4.4.0/source/js/main.js"></script><script src="https://npm.elemecdn.com/@fancyapps/ui/dist/fancybox.umd.js"></script><script src="https://npm.elemecdn.com/instant.page/instantpage.js" type="module"></script><script src="https://npm.elemecdn.com/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://npm.elemecdn.com/node-snackbar/dist/snackbar.min.js"></script><script src="https://npm.elemecdn.com/hexo-theme-butterfly/source/js/search/local-search.js"></script><div class="js-pjax"><script>(()=>{const e=document.querySelectorAll("#article-container .mermaid-wrap");if(e.length){window.runMermaid=()=>{window.loadMermaid=!0;const t="dark"===document.documentElement.getAttribute("data-theme")?"dark":"default";Array.from(e).forEach(((e,n)=>{const d=e.firstElementChild,r="mermaid-"+n,m="%%{init:{ 'theme':'"+t+"'}}%%\n"+d.textContent;mermaid.mermaidAPI.render(r,m,(e=>{d.insertAdjacentHTML("afterend",e)}))}))};const t=()=>{window.loadMermaid?runMermaid():getScript("https://npm.elemecdn.com/mermaid/dist/mermaid.min.js").then(runMermaid)};window.pjax?t():document.addEventListener("DOMContentLoaded",t)}})()</script><script>(()=>{const o=()=>{twikoo.init(Object.assign({el:"#twikoo-wrap",envId:"https://blog2.webxc.eu.org/",region:"",onCommentLoaded:function(){btf.loadLightbox(document.querySelectorAll("#twikoo .tk-content img:not(.tk-owo-emotion)"))}},null))},t=()=>{"object"!=typeof twikoo?getScript("https://npm.elemecdn.com/twikoo@1.6.16/dist/twikoo.all.min.js").then(o):setTimeout(o,0)};t()})()</script></div><script data-pjax="false" defer src="https://npm.elemecdn.com/webxc@1.0.16/css/style.js"></script><script defer src="https://npm.elemecdn.com/hexo-theme-butterfly@4.4.0/source/js/search/local-search.js"></scrip><script src="https://npm.elemecdn.com/butterfly-extsrc/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful=!0,POWERMODE.shake=!0,POWERMODE.mobile=!0,document.body.addEventListener("input",POWERMODE)</script><script src="https://npm.elemecdn.com/pjax@0.2.8/pjax.min.js"></script><script>let pjaxSelectors=["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax",".tk-comments-container"];var pjax=new Pjax({elements:'a:not([target="_blank"])',selectors:pjaxSelectors,cacheBust:!1,analytics:!1,scrollRestoration:!1});document.addEventListener("pjax:send",(function(){if(window.tocScrollFn&&window.removeEventListener("scroll",window.tocScrollFn),window.scrollCollect&&window.removeEventListener("scroll",scrollCollect),"object"==typeof preloader&&preloader.initLoading(),document.getElementById("rightside").style.cssText="opacity: ''; transform: ''",window.aplayers)for(let e=0;e<window.aplayers.length;e++)window.aplayers[e].options.fixed||window.aplayers[e].destroy();"object"==typeof typed&&typed.destroy();const e=document.body.classList;e.contains("read-mode")&&e.remove("read-mode"),"object"==typeof disqusjs&&disqusjs.destroy()})),document.addEventListener("pjax:complete",(function(){window.refreshFn(),document.querySelectorAll("script[data-pjax]").forEach((e=>{const t=document.createElement("script"),o=e.text||e.textContent||e.innerHTML||"";Array.from(e.attributes).forEach((e=>t.setAttribute(e.name,e.value))),t.appendChild(document.createTextNode(o)),e.parentNode.replaceChild(t,e)})),GLOBAL_CONFIG.islazyload&&window.lazyLoadInstance.update(),"function"==typeof chatBtnFn&&chatBtnFn(),"function"==typeof panguInit&&panguInit(),"function"==typeof gtag&&gtag("config","",{page_path:window.location.pathname}),"object"==typeof _hmt&&_hmt.push(["_trackPageview",window.location.pathname]),"function"==typeof loadMeting&&document.getElementsByClassName("aplayer").length&&loadMeting(),"object"==typeof Prism&&Prism.highlightAll(),"object"==typeof preloader&&preloader.endLoading()})),document.addEventListener("pjax:error",(e=>{404===e.request.status&&pjax.loadUrl("/404.html")}))</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script data-pjax>function butterfly_swiper_injector_config(){var s=document.getElementById("recent-posts");console.log("已挂载butterfly_swiper"),s.insertAdjacentHTML("afterbegin",'<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-08-31</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/ds2s/&quot;);" href="javascript:void(0);" alt="">整个前端面试题</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-08-28</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/ds23/&quot;);" href="javascript:void(0);" alt="">常见前端面试题</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-07-26</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/fe33/&quot;);" href="javascript:void(0);" alt="">硅谷甄选运营平台</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-07-17</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/ew32/&quot;);" href="javascript:void(0);" alt="">Vue第三天</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-07-16</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/aw92/&quot;);" href="javascript:void(0);" alt="">Vue第二天</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-07-14</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/ou67/&quot;);" href="javascript:void(0);" alt="">Vue第一天</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/vue.png);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-07-05</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/fn32/&quot;);" href="javascript:void(0);" alt="">Vue框架笔记</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://npm.elemecdn.com/webxc/cover/js1.webp);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-06-21</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/fe11/&quot;);" href="javascript:void(0);" alt="">Vue前置JS功底</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/promise.webp);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-06-11</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/pr67/&quot;);" href="javascript:void(0);" alt="">ES6-Promise语法与原理</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/ajax.webp);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-06-08</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/or01/&quot;);" href="javascript:void(0);" alt="">Ajax第四天</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://cdn1.tianli0.top/gh/web-xc/iMG/postss/ajax.webp);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-06-07</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/fs67/&quot;);" href="javascript:void(0);" alt="">Ajax第三天</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://npm.elemecdn.com/webxc/cover/js1.webp);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-05-11</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/fe66/&quot;);" href="javascript:void(0);" alt="">JS进阶第四天</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://npm.elemecdn.com/webxc/cover/js1.webp);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-05-10</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/fe99/&quot;);" href="javascript:void(0);" alt="">JS进阶第三天</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://npm.elemecdn.com/webxc/cover/js1.webp);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2023-05-05</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/us87/&quot;);" href="javascript:void(0);" alt="">JS进阶第二天</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://npm.elemecdn.com/webxc@1.0.12/cover/cover15.jpg);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2022-10-31</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/2db5/&quot;);" href="javascript:void(0);" alt="">移动开发-Flex布局</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://npm.elemecdn.com/webxc@1.0.12/cover/cover16.jpg);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2022-11-14</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/1c7e/&quot;);" href="javascript:void(0);" alt="">移动开发-媒体查询</a><div class="blog-slider__text">点击查看</div></div></div><div class="blog-slider__item swiper-slide" style="background:url(https://npm.elemecdn.com/webxc@1.0.12/cover/cover17.jpg);border-radius:12px;opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><div class="blog-slider__content"><span class="blog-slider__code">2022-11-17</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/7fc/&quot;);" href="javascript:void(0);" alt="">移动开发-响应式</a><div class="blog-slider__text">点击查看</div></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div><div class="swiper-button-prev"></div><div class="swiper-button-next"></div></div></div>')}for(var elist="null".split(","),cpage=location.pathname,epage="all",flag=0,i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&butterfly_swiper_injector_config()</script><script defer src="https://npm.elemecdn.com/webxc@1.0.12/css/swiper/swiper.min.js"></script><script defer data-pjax src="https://npm.elemecdn.com/webxc@1.0.12/css/swiper/swiper_init.js"></script></body></html>